<?php
// 更改密码
// header("content-type:text/html;charset=UTF-8");
include_once("conn.php");
include_once("u_getLoginInfo.php");
if($status != 1){
    die("<script>alert('账户处于待注销状态，不可操作！');history.go(-1);</script>");
}
if ($pwd != $_POST['oldPwd']) {
    echo "<script>alert('初始密码错误！请重试！');history.go(-1);</script>";
    exit();
}

$newPwd = $_POST['newPwd'];

$update_pwd = "UPDATE user_infos SET user_Password = '" . $newPwd . "' WHERE user_ID = '" . $userID . "'";
if (mysqli_query($connect_DB, $update_pwd)) {
    session_unset();
    session_destroy();
    echo "<script type='text/javascript'>alert('密码修改成功！请重新登录！');location='user_login.html';</script>";
    $connect_DB->close();
    exit();
} else {
    echo "<script type='text/javascript'>alert('密码修改失败！请重试！');history.go(-1);</script>";
}

$connect_DB->close();
?>